//
//	ZcoModelScenarioList.m
//	Model file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport



#import "ZcoModelScenarioList.h"

NSString *const kZcoModelScenarioListCount = @"count";
NSString *const kZcoModelScenarioListScenList = @"scenList";

@interface ZcoModelScenarioList ()
@end
@implementation ZcoModelScenarioList




/**
 * Instantiate the instance using the passed dictionary values to set the properties values
 */

-(instancetype)initWithDictionary:(NSDictionary *)dictionary
{
	self = [super init];
	if(![dictionary[kZcoModelScenarioListCount] isKindOfClass:[NSNull class]]){
		self.count = [dictionary[kZcoModelScenarioListCount] integerValue];
	}

	if(dictionary[kZcoModelScenarioListScenList] != nil && [dictionary[kZcoModelScenarioListScenList] isKindOfClass:[NSArray class]]){
		NSArray * scenListDictionaries = dictionary[kZcoModelScenarioListScenList];
		NSMutableArray * scenListItems = [NSMutableArray array];
		for(NSDictionary * scenListDictionary in scenListDictionaries){
            ZcoModelScenario * scenListItem = [[ZcoModelScenario alloc] initWithDictionary:scenListDictionary];
			[scenListItems addObject:scenListItem];
		}
		self.scenList = scenListItems;
	}
	return self;
}


/**
 * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property
 */
-(NSDictionary *)toDictionary
{
	NSMutableDictionary * dictionary = [NSMutableDictionary dictionary];
	dictionary[kZcoModelScenarioListCount] = @(self.count);
	if(self.scenList != nil){
		NSMutableArray * dictionaryElements = [NSMutableArray array];
		for(ZcoModelScenario * scenListElement in self.scenList){
			[dictionaryElements addObject:[scenListElement toDictionary]];
		}
		dictionary[kZcoModelScenarioListScenList] = dictionaryElements;
	}
	return dictionary;

}

/**
 * Implementation of NSCoding encoding method
 */
/**
 * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property
 */
- (void)encodeWithCoder:(NSCoder *)aCoder
{
	[aCoder encodeObject:@(self.count) forKey:kZcoModelScenarioListCount];	if(self.scenList != nil){
		[aCoder encodeObject:self.scenList forKey:kZcoModelScenarioListScenList];
	}

}

/**
 * Implementation of NSCoding initWithCoder: method
 */
- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
	self = [super init];
	self.count = [[aDecoder decodeObjectForKey:kZcoModelScenarioListCount] integerValue];
	self.scenList = [aDecoder decodeObjectForKey:kZcoModelScenarioListScenList];
	return self;

}

/**
 * Implementation of NSCopying copyWithZone: method
 */
- (instancetype)copyWithZone:(NSZone *)zone
{
	ZcoModelScenarioList *copy = [ZcoModelScenarioList new];

	copy.count = self.count;
	copy.scenList = [self.scenList copy];

	return copy;
}
@end
